var api = require("../../api.js"),
  app = getApp();
const {
  $Toast
} = require('../../iview-weapp/base/index');
Page({
  /** 页面的初始数据 */
  data: {
    /** 预约时间 */
    appoint_time:'',
    loading:false,
    show: false,
    currentDate: new Date().getTime(),
    minDate: new Date().getTime(),
    formatter(type, value) {
      if (type === 'year') {
        return `${value}年`;
      } else if (type === 'month') {
        return `${value}月`;
      }
      return value;
    }
  },
  on_input(event) {
    this.setData({
      currentDate: event.detail
    });
    
  },
  /** 关闭弹框 */
  on_cancel() {
    this.setData({ show: false });
  },
  show_time(){
    this.setData({ show: true });
  },
  /** 点击完成时间 */
  on_confirme(){
    this.setData({ 
      show: false,
      appoint_time:this.data.currentDate
    });
  },
  /** 提交申请 */
  sub_form:function(){
    this.setData({  loading: true});
    setTimeout(() => {
      this.setData({ loading:false});
      console.log('提交信息')
      /** 申请提交成功 */
      $Toast({
        content: '服务申请已提交',
        type: 'success'
      });
      
    }, 2000);
  }




});